<?php

namespace StarCloud\Services;

use StarCloud\Library\Jwt;
use StarCloud\Models\InterfaceUser;

class TokenService extends BaseService
{
    public static function saveToken(InterfaceUser $user)
    {
        if ($user->getId() <= 2) {
            $expireTime = 86400 *7;
        } else {
            $expireTime = 864000;
        }

        return Jwt::getToken($user->toArray(), $expireTime);
    }

    public static function verifyToken($token)
    {
        return Jwt::verifyToken($token);
    }
}
